package org.xxpay.pay.channel.funpay;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * @description: FUN支付
 */
@Component
public class FunpayConfig {

    public static final String CHANNEL_NAME = "funpay"; //渠道名称

    public static final String CHANNEL_TYPE_WX_H5 = CHANNEL_NAME + "_wxpay_h5"; // 微信H5
    public static final String CHANNEL_TYPE_ALI_H5 = "_alipay_h5"; // 支付宝H5

    public static final String RETURN_VALUE_SUCCESS = "SUCCESS";    // 回调返回状态
    public static final String RETURN_VALUE_ERROR = "error";


    private String mchId; // 商户ID

    private String key;  // 商户Key

    private String reqUrl;  // 请求网关地址

    public FunpayConfig(){}

    public FunpayConfig(String payParam) {
        Assert.notNull(payParam, "init funpay config error");
        JSONObject object = JSONObject.parseObject(payParam);
        this.mchId = object.getString("mchId");
        this.key = object.getString("key");
        this.reqUrl = object.getString("reqUrl");
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getReqUrl() {
        return reqUrl;
    }

    public void setReqUrl(String reqUrl) {
        this.reqUrl = reqUrl;
    }
}
